#define _CRT_SECURE_NO_WARNINGS 1

/**
 * Definition for a binary tree node.
 * struct TreeNode {
 *     int val;
 *     struct TreeNode *left;
 *     struct TreeNode *right;
 * };
 */

#include<stdio.h>

int maxDepth(struct TreeNode* root)
{
    if (root == NULL)
    {
        return 0;
    }

    int depth_left = maxDepth(root->left);
    int depth_right = maxDepth(root->right);

    return depth_left > depth_right ? depth_left + 1 : depth_right + 1;
}